<template>
  <div id="app">
    <keep-alive>
      <router-view v-if="$route.meta.keepAlive"></router-view>
    </keep-alive>
    <router-view v-if="!$route.meta.keepAlive"></router-view>
  </div>
</template>

<script>
import axios from 'axios'
export default {
  name: 'App',
  created(){
    if(this.$U.getCookie('token')){
      axios.defaults.headers['Authorization'] = 'JWT ' + this.$U.getCookie('token');
      axios.get('/api/get_js_api/').then((res)=>{
        if(res.data){
          this.$dd.config({
            agentId: res.data.agentId,
            corpId: res.data.corpId,
            timeStamp:res.data.timeStamp,
            nonceStr: res.data.nonceStr,
            signature: res.data.signature,
            jsApiList: [
              'biz.util.open',
              'biz.ding.create',
            ]
          });
        }else{
          this.$dd.device.notification.alert({
            message: "鉴权失败,请重新进入应用",
            buttonName: "确定",
          })
        }
      }).catch((err)=>{
        console.log(err)
      })
    }
  },
}
</script>

<style lang="less">
  html{
    font-family: 'AdobeHeitiStd-Regular',Arial, Helvetica, sans-serif;
    background-color: rgb(246,246,246);
  }
  .home{
    .van-cell__title{
      font-size: 16px;
    }
  }
</style>
